dependencies = [
"curl 0.1.0 (git+https://github.com/carllerche/curl-rust)",
"docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)",
- "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
+ "flate2 0.0.3 (git+https://github.com/alexcrichton/flate2-rs)",
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
- "glob 0.0.1 (git+https://github.com/rust-lang/glob)",
+ "glob 0.0.3 (git+https://github.com/rust-lang/glob)",
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
"registry 0.0.1-pre",
- "semver 0.1.0 (git+https://github.com/rust-lang/semver)",
- "tar 0.0.1 (git+https://github.com/alexcrichton/tar-rs)",
- "time 0.0.1 (git+https://github.com/rust-lang/time)",
- "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs)",
+ "semver 0.1.3 (git+https://github.com/rust-lang/semver)",
+ "tar 0.0.3 (git+https://github.com/alexcrichton/tar-rs)",
+ "time 0.0.3 (git+https://github.com/rust-lang/time)",
+ "toml 0.1.2 (git+https://github.com/alexcrichton/toml-rs)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
]
[[package]]
name = "curl"
version = "0.1.0"
-source = "git+https://github.com/carllerche/curl-rust#e6e31d8d601bffdf3c9b31993e6ffe3bc8a99618"
+source = "git+https://github.com/carllerche/curl-rust#c1b96e146f6752353a1e84cca932c628e6bf73af"
dependencies = [
"curl-sys 0.1.0 (git+https://github.com/carllerche/curl-rust)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
[[package]]
name = "curl-sys"
version = "0.1.0"
-source = "git+https://github.com/carllerche/curl-rust#e6e31d8d601bffdf3c9b31993e6ffe3bc8a99618"
+source = "git+https://github.com/carllerche/curl-rust#c1b96e146f6752353a1e84cca932c628e6bf73af"
dependencies = [
"libz-sys 0.0.1 (git+https://github.com/alexcrichton/libz-sys)",
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
[[package]]
name = "docopt"
version = "0.6.8"
-source = "git+https://github.com/docopt/docopt.rs#911d25c7328c0fdc6499757b9dcb831472e3cc13"
-
-[[package]]
-name = "encoding"
-version = "0.2.1"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
- "encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
- "encoding-index-simpchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
- "encoding-index-singlebyte 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
- "encoding-index-tradchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding-index-japanese"
-version = "1.0.20140915"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding-index-korean"
-version = "1.0.20140915"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding-index-simpchinese"
-version = "1.0.20140915"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding-index-singlebyte"
-version = "1.0.20140915"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding-index-tradchinese"
-version = "1.0.20140915"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
-dependencies = [
- "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
-
-[[package]]
-name = "encoding_index_tests"
-version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
+source = "git+https://github.com/docopt/docopt.rs#be2e3b6b91ab1912d79f1e840d9397dead6e6a6e"
[[package]]
name = "flate2"
-version = "0.0.1"
-source = "git+https://github.com/alexcrichton/flate2-rs#f81e6dc401b2bf32c8274fa1b8327699fb9345c0"
+version = "0.0.3"
+source = "git+https://github.com/alexcrichton/flate2-rs#044e4dc2a766bc32fd5ae76bbe958be6e85be481"
dependencies = [
- "miniz-sys 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
+ "miniz-sys 0.0.2 (git+https://github.com/alexcrichton/flate2-rs)",
]
[[package]]
name = "gcc"
-version = "0.0.1"
-source = "git+https://github.com/alexcrichton/gcc-rs#f25b3ba9c40303781189cc137fb98fffe5b56de7"
+version = "0.0.2"
+source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
[[package]]
name = "git2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#f188fc297b00261372bd3b4f7855cd8082e78cfc"
+source = "git+https://github.com/alexcrichton/git2-rs#d0d21ca14b4a410806b577b04c2d29f7f8e45f61"
dependencies = [
"libgit2-sys 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
- "time 0.0.1 (git+https://github.com/rust-lang/time)",
+ "time 0.0.3 (git+https://github.com/rust-lang/time)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
]
[[package]]
name = "glob"
-version = "0.0.1"
-source = "git+https://github.com/rust-lang/glob#5d7ad1dc2f10f8e23b93c025cf5b984d79cf7169"
+version = "0.0.3"
+source = "git+https://github.com/rust-lang/glob#9efe98bd82ad4932819888a94eb933ac618312f0"
[[package]]
name = "hamcrest"
[[package]]
name = "libgit2-sys"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#f188fc297b00261372bd3b4f7855cd8082e78cfc"
+source = "git+https://github.com/alexcrichton/git2-rs#d0d21ca14b4a410806b577b04c2d29f7f8e45f61"
dependencies = [
"libssh2-sys 0.0.1 (git+https://github.com/alexcrichton/ssh2-rs)",
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
[[package]]
name = "libssh2-sys"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/ssh2-rs#6118d76bb383420be32160af866cbe5fc7141f42"
+source = "git+https://github.com/alexcrichton/ssh2-rs#922531da4c22abe7a216672314315d41769d7fb1"
dependencies = [
"libz-sys 0.0.1 (git+https://github.com/alexcrichton/libz-sys)",
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
[[package]]
name = "miniz-sys"
-version = "0.0.1"
-source = "git+https://github.com/alexcrichton/flate2-rs#f81e6dc401b2bf32c8274fa1b8327699fb9345c0"
+version = "0.0.2"
+source = "git+https://github.com/alexcrichton/flate2-rs#044e4dc2a766bc32fd5ae76bbe958be6e85be481"
dependencies = [
- "gcc 0.0.1 (git+https://github.com/alexcrichton/gcc-rs)",
+ "gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]
name = "openssl-sys"
version = "0.0.1"
-source = "git+https://github.com/sfackler/rust-openssl#af5533d936558a77c2de8c5d2d572bb1f89dfada"
+source = "git+https://github.com/sfackler/rust-openssl#b084ddc7b0fe9c7816fef6e415a05db6ec43fb71"
dependencies = [
"pkg-config 0.0.1 (git+https://github.com/alexcrichton/pkg-config-rs)",
]
[[package]]
name = "semver"
-version = "0.1.0"
-source = "git+https://github.com/rust-lang/semver#1672853e20ef4bde672b08d55de40941d907649a"
+version = "0.1.3"
+source = "git+https://github.com/rust-lang/semver#29212953f839337c672d185dde74e14b5dfb1f46"
[[package]]
name = "tar"
-version = "0.0.1"
-source = "git+https://github.com/alexcrichton/tar-rs#868632ea0dd36200377af2c445d71d387cba1702"
+version = "0.0.3"
+source = "git+https://github.com/alexcrichton/tar-rs#55fa87d43eaf2a54c55ddd245e1c13859a06193c"
[[package]]
name = "time"
-version = "0.0.1"
-source = "git+https://github.com/rust-lang/time#3194d911a136a7bfa3218cdd5bd3379537de4133"
+version = "0.0.3"
+source = "git+https://github.com/rust-lang/time#533d3823dbe200aaa2a2599176a6b30579581232"
dependencies = [
- "gcc 0.0.1 (git+https://github.com/alexcrichton/gcc-rs)",
+ "gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]
name = "toml"
-version = "0.1.0"
-source = "git+https://github.com/alexcrichton/toml-rs#4bb575fdaf5fd88580abbac6fdb057ef76d32251"
+version = "0.1.2"
+source = "git+https://github.com/alexcrichton/toml-rs#1e35b001094b20d2452adff305e418591d4000fb"
[[package]]
name = "url"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#c3d32dae4c5641d034a848d42f88db48dd9feb96"
-dependencies = [
- "encoding 0.2.1 (git+https://github.com/lifthrasiir/rust-encoding)",
-]
+source = "git+https://github.com/servo/rust-url#a838a41263472de966f7ec8db758caa9cc4699a4"
pub fn execute(args: ConfigForKeyFlags,
_: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
- let value = try!(config::get_config(os::getcwd(),
- args.flag_key.as_slice()).map_err(|_| {
+ let cwd = try!(os::getcwd().map_err(|_|
+ CliError::new("Couldn't determine the current working directory", 1)));
+ let value = try!(config::get_config(cwd, args.flag_key.as_slice()).map_err(|_| {
CliError::new("Couldn't load configuration", 1)
}));
pub fn execute(args: ConfigListFlags,
_: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
- let configs = try!(config::all_configs(os::getcwd()).map_err(|_|
+ let cwd = try!(os::getcwd().map_err(|_|
+ CliError::new("Couldn't determine the current working directory", 1)));
+ let configs = try!(config::all_configs(cwd).map_err(|_|
CliError::new("Couldn't load configuration", 1)));
if args.flag_human {
fn mapper(scheme: &str) -> url::SchemeType {
if scheme == "cargo" {
- url::RelativeScheme(1)
+ url::SchemeType::Relative(1)
} else {
url::whatwg_scheme_type_mapper(scheme)
}
// map a dependency though, we just pass it on through.
fn lock(&self, summary: Summary) -> Summary {
let pair = self.locked.get(summary.get_source_id()).and_then(|map| {
- map.find_equiv(summary.get_name())
+ map.get(summary.get_name())
}).and_then(|vec| {
vec.iter().find(|&&(ref id, _)| id == summary.get_package_id())
});
// on.
None => {
let v = self.locked.get(dep.get_source_id()).and_then(|map| {
- map.find_equiv(dep.get_name())
+ map.get(dep.get_name())
}).and_then(|vec| {
vec.iter().find(|&&(ref id, _)| dep.matches_id(id))
});
.map(|s| s.to_string());
assert!(tmp.insert(pkgid.clone(), precise).is_none(),
"a package was referenced twice in the lockfile");
- g.add(try!(pkg.to_package_id(default)), []);
+ g.add(try!(pkg.to_package_id(default)), &[]);
Ok(())
};
impl Resolve {
fn new(root: PackageId) -> Resolve {
let mut g = Graph::new();
- g.add(root.clone(), []);
+ g.add(root.clone(), &[]);
Resolve { graph: g, root: root, features: HashMap::new(), metadata: None }
}
None => features.len() == 0,
}
} else {
- my_cx.resolve.graph.add(candidate.get_package_id().clone(), []);
+ my_cx.resolve.graph.add(candidate.get_package_id().clone(), &[]);
prev.push(candidate.clone());
false
}
// features that correspond to optional dependencies
for dep in deps {
// weed out optional dependencies, but not those required
- if dep.is_optional() && !feature_deps.contains_key_equiv(dep.get_name()) {
+ if dep.is_optional() && !feature_deps.contains_key(dep.get_name()) {
continue
}
- let mut base = feature_deps.pop_equiv(dep.get_name())
- .unwrap_or(Vec::new());
+ let mut base = feature_deps.remove(dep.get_name()).unwrap_or(vec![]);
for feature in dep.get_features().iter() {
base.push(feature.clone());
if feature.as_slice().contains("/") {
}
match method {
Method::Everything | Method::Required(_, _, true, _) => {
- if s.get_features().find_equiv("default").is_some() &&
- !visited.contains_equiv("default") {
+ if s.get_features().get("default").is_some() &&
+ !visited.contains("default") {
try!(add_feature(s, "default", &mut deps, &mut used,
&mut visited));
}
feat)))
}
used.insert(feat.to_string());
- match s.get_features().find_equiv(feat) {
+ match s.get_features().get(feat) {
Some(recursive) => {
for f in recursive.iter() {
try!(add_feature(s, f.as_slice(), deps, used,
dependencies: Vec<Dependency>,
features: HashMap<String, Vec<String>>) -> CargoResult<Summary> {
for dep in dependencies.iter() {
- if features.find_equiv(dep.get_name()).is_some() {
+ if features.get(dep.get_name()).is_some() {
return Err(human(format!("Features and dependencies cannot have \
the same name: `{}`", dep.get_name())))
}
let mut parts = dep.as_slice().splitn(1, '/');
let dep = parts.next().unwrap();
let is_reexport = parts.next().is_some();
- if !is_reexport && features.find_equiv(dep).is_some() { continue }
+ if !is_reexport && features.get(dep).is_some() { continue }
match dependencies.iter().find(|d| d.get_name() == dep) {
Some(d) => {
if d.is_optional() || is_reexport { continue }
let pkg = {
let mut source = pkgid.get_source_id().load(&mut cfg);
try!(source.update());
- (try!(source.get([pkgid.clone()]))).into_iter().next().unwrap()
+ (try!(source.get(&[pkgid.clone()]))).into_iter().next().unwrap()
};
// Create a compilation context to have access to information like target
// filenames and such
let srcs = SourceMap::new();
- let pkgs = PackageSet::new([]);
+ let pkgs = PackageSet::new(&[]);
let cx = try!(Context::new("compile", &resolve, &srcs, &pkgs, &mut cfg,
Layout::at(root.get_absolute_target_dir()),
None, &pkg, Default::default()));
is not being built"))
}
- let user_configs = try!(config::all_configs(os::getcwd()));
+ let user_configs = try!(config::all_configs(try!(os::getcwd())));
let override_ids = try!(source_ids_from_config(&user_configs,
package.get_root()));
let config = try!(Config::new(*shell, jobs, target.clone()));
cur_path: Path) -> CargoResult<Vec<SourceId>> {
debug!("loaded config; configs={}", configs);
- let config_paths = match configs.find_equiv("paths") {
+ let config_paths = match configs.get("paths") {
Some(cfg) => cfg,
None => return Ok(Vec::new())
};
fn scrape_build_config(config: &Config,
configs: &HashMap<String, config::ConfigValue>)
-> CargoResult<ops::BuildConfig> {
- let target = match configs.find_equiv("target") {
+ let target = match configs.get("target") {
None => return Ok(Default::default()),
Some(target) => try!(target.table().chain_error(|| {
internal("invalid configuration for the key `target`")
}
pub fn new(opts: NewOptions, _shell: &mut MultiShell) -> CargoResult<()> {
- let path = os::getcwd().join(opts.path);
+ let path = try!(os::getcwd()).join(opts.path);
if path.exists() {
return Err(human(format!("Destination `{}` already exists",
path.display())))
}
fn global_config() -> CargoResult<CargoNewConfig> {
- let user_configs = try!(config::all_configs(os::getcwd()));
+ let user_configs = try!(config::all_configs(try!(os::getcwd())));
let mut cfg = CargoNewConfig {
name: None,
email: None,
git: None,
};
- let cargo_new = match user_configs.find_equiv("cargo-new") {
+ let cargo_new = match user_configs.get("cargo-new") {
None => return Ok(cfg),
Some(target) => try!(target.table().chain_error(|| {
internal("invalid configuration for the key `cargo-new`")
})),
};
- cfg.name = match cargo_new.find_equiv("name") {
+ cfg.name = match cargo_new.get("name") {
None => None,
Some(name) => {
Some(try!(name.string().chain_error(|| {
})).ref0().to_string())
}
};
- cfg.email = match cargo_new.find_equiv("email") {
+ cfg.email = match cargo_new.get("email") {
None => None,
Some(email) => {
Some(try!(email.string().chain_error(|| {
})).ref0().to_string())
}
};
- cfg.git = match cargo_new.find_equiv("git") {
+ cfg.git = match cargo_new.get("git") {
None => None,
Some(git) => {
Some(try!(git.boolean().chain_error(|| {
jobs: None,
target: None,
dev_deps: false,
- features: [],
+ features: &[],
no_default_features: false,
spec: None,
lib_only: false,
Some(s) => dst.join(s).join(bin.get_name()),
None => dst.join(bin.get_name()),
};
- let exe = match exe.path_relative_from(&os::getcwd()) {
+ let exe = match exe.path_relative_from(&try!(os::getcwd())) {
Some(path) => path,
None => exe,
};
let process = try!(compile.process(exe, &root))
- .args(args).cwd(os::getcwd());
+ .args(args)
+ .cwd(try!(os::getcwd()));
try!(options.shell.status("Running", process.to_string()));
Ok(process.exec().err())
search_path.push(self.deps_output.clone());
let search_path = try!(util::join_paths(search_path.as_slice(),
DynamicLibrary::envvar()));
- let mut cmd = util::process(cmd).env(DynamicLibrary::envvar(),
- Some(search_path.as_slice()));
+ let mut cmd = try!(util::process(cmd)).env(
+ DynamicLibrary::envvar(), Some(search_path.as_slice()));
for (k, v) in self.extra_env.iter() {
cmd = cmd.env(k.as_slice(), v.as_ref().map(|s| s.as_slice()));
}
/// specified as well as the exe suffix
fn filename_parts(target: Option<&str>)
-> CargoResult<(Option<(String, String)>, String)> {
- let process = util::process("rustc")
+ let process = try!(util::process("rustc"))
.arg("-")
.arg("--crate-name").arg("-")
.arg("--crate-type").arg("dylib")
/// The second element of the tuple returned is the target triple that rustc
/// is a host for.
pub fn rustc_version() -> CargoResult<(String, String)> {
- let output = try!(util::process("rustc").arg("-v").arg("verbose")
- .exec_with_output());
+ let output = try!(try!(util::process("rustc"))
+ .arg("-v")
+ .arg("verbose")
+ .exec_with_output());
let output = try!(String::from_utf8(output.output).map_err(|_| {
internal("rustc -v didn't return utf8 output")
}));
cmd = cmd.arg("--opt-level").arg(profile.get_opt_level().to_string());
}
if (target.is_bin() || target.is_staticlib()) && profile.get_lto() {
- cmd = cmd.args(["-C", "lto"]);
+ cmd = cmd.args(&["-C", "lto"]);
} else {
// There are some restrictions with LTO and codegen-units, so we
// only add codegen units when LTO is not used.
if profile.get_debug() {
cmd = cmd.arg("-g");
} else {
- cmd = cmd.args(["--cfg", "ndebug"]);
+ cmd = cmd.args(&["--cfg", "ndebug"]);
}
if profile.is_test() && profile.uses_test_harness() {
target_name.map_or(true, |target_name| target_name == test_name.as_slice())
});
- let cwd = os::getcwd();
+ let cwd = try!(os::getcwd());
for &(_, ref exe) in tests_to_run {
let to_display = match exe.path_relative_from(&cwd) {
Some(path) => path,
use std::io::File;
use serialize::{Encodable, Decodable};
-use toml::{mod, Encoder};
+use toml::{mod, Encoder, Value};
use core::{Resolve, resolver, Package, SourceId};
use util::CargoResult;
}
if let Some(ref s) = dep.get(&"dependencies".to_string()) {
- let slice = s.as_slice().unwrap();
+ let slice = Value::as_slice(*s).unwrap();
if !slice.is_empty() {
out.push_str("dependencies = [\n");
- for child in s.as_slice().unwrap().iter() {
+ for child in slice.iter() {
out.push_str(format!(" {},\n", child).as_slice());
}
}
pub fn registry_configuration() -> CargoResult<RegistryConfig> {
- let configs = try!(config::all_configs(os::getcwd()));
- let registry = match configs.find_equiv("registry") {
+ let configs = try!(config::all_configs(try!(os::getcwd())));
+ let registry = match configs.get("registry") {
None => return Ok(RegistryConfig { index: None, token: None }),
Some(registry) => try!(registry.table().chain_error(|| {
internal("invalid configuration for the key `registry`")
})),
};
- let index = match registry.find_equiv("index") {
+ let index = match registry.get("index") {
None => None,
Some(index) => {
Some(try!(index.string().chain_error(|| {
})).ref0().to_string())
}
};
- let token = match registry.find_equiv("token") {
+ let token = match registry.get("token") {
None => None,
Some(token) => {
Some(try!(token.string().chain_error(|| {
/// Favor cargo's `http.proxy`, then git's `http.proxy`, then finally a
/// HTTP_PROXY env var.
pub fn http_proxy() -> CargoResult<Option<String>> {
- let configs = try!(config::all_configs(os::getcwd()));
- match configs.find_equiv("http") {
+ let configs = try!(config::all_configs(try!(os::getcwd())));
+ match configs.get("http") {
Some(http) => {
let http = try!(http.table().chain_error(|| {
internal("invalid configuration for the key `http`")
}));
- match http.find_equiv("proxy") {
+ match http.get("proxy") {
Some(proxy) => {
return Ok(Some(try!(proxy.string().chain_error(|| {
internal("invalid configuration for key `http.proxy`")
let config = try!(Config::new(shell, None, None));
let RegistryConfig { index, token: _ } = try!(registry_configuration());
let mut map = HashMap::new();
- let p = os::getcwd();
+ let p = try!(os::getcwd());
match index {
Some(index) => {
map.insert("index".to_string(), ConfigValue::String(index, p.clone()));
// Strip a trailing slash
match url.scheme_data {
- url::RelativeSchemeData(ref mut rel) => {
+ url::SchemeData::Relative(ref mut rel) => {
if rel.path.last().map(|s| s.is_empty()).unwrap_or(false) {
rel.path.pop();
}
if url.domain() == Some("github.com") {
url.scheme = "https".to_string();
match url.scheme_data {
- url::RelativeSchemeData(ref mut rel) => {
+ url::SchemeData::Relative(ref mut rel) => {
rel.port = Some(443);
rel.default_port = Some(443);
let path = mem::replace(&mut rel.path, Vec::new());
// Repos generally can be accessed with or w/o '.git'
match url.scheme_data {
- url::RelativeSchemeData(ref mut rel) => {
+ url::SchemeData::Relative(ref mut rel) => {
let needs_chopping = {
let last = rel.path.last().map(|s| s.as_slice()).unwrap_or("");
last.ends_with(".git")
/// Parse the on-disk metadata for the package provided
fn summaries(&mut self, name: &str) -> CargoResult<&Vec<(Summary, bool)>> {
- if self.cache.contains_key_equiv(name) {
- return Ok(self.cache.find_equiv(name).unwrap());
+ if self.cache.contains_key(name) {
+ return Ok(self.cache.get(name).unwrap());
}
// see module comment for why this is structured the way it is
let path = self.checkout_path.clone();
Err(..) => Vec::new(),
};
self.cache.insert(name.to_string(), summaries);
- Ok(self.cache.find_equiv(name).unwrap())
+ Ok(self.cache.get(name).unwrap())
}
/// Parse a line from the registry's index file into a Summary for a
use std::io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal};
use std::io::IoError;
-use std::fmt::{mod, Show, Formatter, FormatError};
+use std::fmt::{mod, Show, Formatter};
use std::str;
use serialize::json;
use semver;
from_error!(TomlError)
-impl CargoError for FormatError {
+impl CargoError for fmt::Error {
fn description(&self) -> String {
"formatting failed".to_string()
}
}
-from_error!(FormatError)
+from_error!(fmt::Error)
impl CargoError for curl::ErrCode {
fn description(&self) -> String { self.to_string() }
/// Find the root Cargo.toml
pub fn find_root_manifest_for_cwd(manifest_path: Option<String>) -> CliResult<Path> {
- match manifest_path {
- Some(path) => Ok(Path::new(path)),
- None => match find_project_manifest(&os::getcwd(), "Cargo.toml") {
- Ok(x) => Ok(x),
- Err(_) => Err(CliError::new("Could not find Cargo.toml in this \
- directory or any parent directory", 102))
- }
- }.map(|path| os::make_absolute(&path))
+ manifest_path.map(|path| Ok(Path::new(path))).unwrap_or_else(|| os::getcwd()
+ .map_err(|_| CliError::new("Couldn't determine the current working directory", 103))
+ .and_then(|cwd| find_project_manifest(&cwd, "Cargo.toml")
+ .map_err(|_| CliError::new("Could not find Cargo.toml in this \
+ directory or any parent directory", 102))
+ )
+ )
+ .and_then(|path| os::make_absolute(&path).map_err(|_|
+ CliError::new("Could not determine the absolute path of the manifest", 104)))
}
/// Return the path to the `file` in `pwd`, if it exists.
pub fn realpath(original: &Path) -> io::IoResult<Path> {
static MAX_LINKS_FOLLOWED: uint = 256;
- let original = os::make_absolute(original);
+ let original = try!(os::make_absolute(original));
// Right now lstat on windows doesn't work quite well
if cfg!(windows) {
use std::io::process::{Command, ProcessOutput, InheritFd};
use std::collections::HashMap;
-use util::{ProcessError, process_error};
+use util::{CargoResult, ProcessError, process_error};
#[deriving(Clone,PartialEq)]
pub struct ProcessBuilder {
}
}
-pub fn process<T: ToCStr>(cmd: T) -> ProcessBuilder {
- ProcessBuilder {
+pub fn process<T: ToCStr>(cmd: T) -> CargoResult<ProcessBuilder> {
+ Ok(ProcessBuilder {
program: cmd.to_c_str(),
args: Vec::new(),
- cwd: os::getcwd(),
+ cwd: try!(os::getcwd()),
env: HashMap::new(),
- }
+ })
}
fn mapper(s: &str) -> url::SchemeType {
match s {
- "git" => url::RelativeScheme(9418),
- "ssh" => url::RelativeScheme(22),
+ "git" => url::SchemeType::Relative(9418),
+ "ssh" => url::SchemeType::Relative(22),
s => url::whatwg_scheme_type_mapper(s),
}
}
layout: Layout)
-> CargoResult<(Manifest, Vec<Path>)> {
let manifest = layout.root.join("Cargo.toml");
- let manifest = match manifest.path_relative_from(&os::getcwd()) {
+ let manifest = match manifest.path_relative_from(&try!(os::getcwd())) {
Some(path) => path,
None => manifest,
};
impl HgRepo {
pub fn init(path: &Path) -> CargoResult<HgRepo> {
let path_str = path.as_str().unwrap();
- try!(process("hg").arg("init").arg(path_str).exec());
+ try!(try!(process("hg")).arg("init").arg(path_str).exec());
return Ok(HgRepo)
}
}
pub fn unyank(&mut self, krate: &str, version: &str) -> Result<()> {
let body = try!(self.put(format!("/crates/{}/{}/unyank", krate, version),
- []));
+ &[]));
assert!(json::decode::<R>(body.as_slice()).unwrap().ok);
Ok(())
}
+2014-11-22
+ linux-i386 3204c8a38721199f69d2971db887d1dc71a63825
+ linux-x86_64 39ca0d02eac184bc764ff9c1f645ca361715c5c2
+ macos-i386 ebc1836424c4b3ba49f9adef271c50d2a8e134c0
+ macos-x86_64 a2045e95984b65eab4a704152566f8ab9a3be518
+ winnt-i386 5e0831b14d2e6ee91ef195dfbc4d9699499d5e99
+ winnt-x86_64 d5fa1b58207346061898459955fa7f0b33d77474
+
2014-11-11
linux-i386 5cbf3346309d303cb954c363097fc4abedf50610
linux-x86_64 8c1594e227eca6f23ba02daa5f3cd6150ac88907
let res = resolve(pkg_id("root"), Vec::new(),
&mut registry(vec!())).unwrap();
- assert_that(&res, equal_to(&names(["root"])));
+ assert_that(&res, equal_to(&names(&["root"])));
}
#[test]
let mut reg = registry(vec!(pkg("foo")));
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg);
- assert_that(&res.unwrap(), contains(names(["root", "foo"])).exactly());
+ assert_that(&res.unwrap(), contains(names(&["root", "foo"])).exactly());
}
#[test]
let mut reg = registry(vec!(pkg("foo"), pkg("bar")));
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg);
- assert_that(&res.unwrap(), contains(names(["root", "foo"])).exactly());
+ assert_that(&res.unwrap(), contains(names(&["root", "foo"])).exactly());
}
#[test]
let res = resolve(pkg_id("root"), vec![dep("foo"), dep("baz")],
&mut reg).unwrap();
- assert_that(&res, contains(names(["root", "foo", "baz"])).exactly());
+ assert_that(&res, contains(names(&["root", "foo", "baz"])).exactly());
}
#[test]
let mut reg = registry(vec!(pkg!("foo"), pkg!("bar" => ["foo"])));
let res = resolve(pkg_id("root"), vec![dep("bar")], &mut reg).unwrap();
- assert_that(&res, contains(names(["root", "foo", "bar"])));
+ assert_that(&res, contains(names(&["root", "foo", "bar"])));
}
#[test]
let res = resolve(pkg_id("root"), vec![dep("foo"), dep("bar")],
&mut reg).unwrap();
- assert_that(&res, contains(names(["root", "foo", "bar"])));
+ assert_that(&res, contains(names(&["root", "foo", "bar"])));
}
#[test]
dep_loc("bar", "http://second.example.com")],
&mut reg);
- let mut names = loc_names([("foo", "http://first.example.com"),
- ("bar", "http://second.example.com")]);
+ let mut names = loc_names(&[("foo", "http://first.example.com"),
+ ("bar", "http://second.example.com")]);
names.push(pkg_id("root"));
vec![dep("foo"), dep("baz").kind(Development)],
&mut reg).unwrap();
- assert_that(&res, contains(names(["root", "foo", "bar", "baz"])));
+ assert_that(&res, contains(names(&["root", "foo", "bar", "baz"])));
}
#[test]
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg).unwrap();
- assert_that(&res, contains(names([("root", "1.0.0"),
- ("foo", "1.0.2")])));
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.2")])));
}
#[test]
let res = resolve(pkg_id("root"), vec![dep_req("foo", "=1.0.1")],
&mut reg).unwrap();
- assert_that(&res, contains(names([("root", "1.0.0"),
- ("foo", "1.0.1")])));
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.1")])));
}
#[test]
dep_req("foo", "^1"),
], &mut reg).unwrap();
- assert_that(&res, contains(names([("root", "1.0.0"),
- ("foo", "1.0.1"),
- ("baz", "1.0.0")])));
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.1"),
+ ("baz", "1.0.0")])));
}
#[test]
dep("bar"),
], &mut reg).unwrap();
- assert_that(&res, contains(names([("root", "1.0.0"),
- ("foo", "1.0.0"),
- ("foo", "2.0.0"),
- ("foo", "0.1.0"),
- ("foo", "0.2.0"),
- ("d1", "1.0.0"),
- ("d2", "1.0.0"),
- ("d3", "1.0.0"),
- ("d4", "1.0.0"),
- ("bar", "1.0.0")])));
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.0"),
+ ("foo", "2.0.0"),
+ ("foo", "0.1.0"),
+ ("foo", "0.2.0"),
+ ("d1", "1.0.0"),
+ ("d2", "1.0.0"),
+ ("d3", "1.0.0"),
+ ("d4", "1.0.0"),
+ ("bar", "1.0.0")])));
}
#[test]
dep_req("foo", "1"),
], &mut reg).unwrap();
- assert_that(&res, contains(names([("root", "1.0.0"),
- ("foo", "1.0.0"),
- ("bar", "2.0.0"),
- ("baz", "1.0.1")])));
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.0"),
+ ("bar", "2.0.0"),
+ ("baz", "1.0.1")])));
}
#[test]
let tree = self.repo.find_tree(id).unwrap();
let sig = self.repo.signature().unwrap();
self.repo.commit(Some("HEAD"), &sig, &sig,
- "Initial commit", &tree, []).unwrap();
+ "Initial commit", &tree, &[]).unwrap();
}
}
use std::io;
use std::os;
use std::path::{Path,BytesContainer};
-use std::str;
+use std::str::{mod, Str};
use std::vec::Vec;
use url::Url;
use hamcrest as ham;
pub fn process<T: ToCStr>(&self, program: T) -> ProcessBuilder {
process(program)
+ .unwrap()
.cwd(self.root())
.env("HOME", Some(paths::home().display().to_string().as_slice()))
}
fn match_std(&self, expected: Option<&String>, actual: &[u8],
description: &str, extra: &[u8]) -> ham::MatchResult {
- match expected.as_ref().map(|s| s.as_slice()) {
+ match expected.map(|s| Str::as_slice(s)) {
None => ham::success(),
Some(out) => {
let actual = match str::from_utf8(actual) {
pub static DOWNLOADING: &'static str = " Downloading";
pub static UPLOADING: &'static str = " Uploading";
pub static VERIFYING: &'static str = " Verifying";
+#[allow(dead_code)]
pub static WARNING: &'static str = " Warning";
let parent = repo.find_commit(parent).unwrap();
repo.commit(Some("HEAD"), &sig, &sig,
"Another commit", &tree,
- [&parent]).unwrap();
+ &[&parent]).unwrap();
}
pub fn pkg(name: &str, vers: &str, deps: &[(&str, &str)], cksum: &str,
test!(list_commands_looks_at_path {
let proj = project("list-non-overlapping");
let proj = fake_executable(proj, &Path::new("path-test"), "cargo-1");
- let pr = process(cargo_dir().join("cargo")).cwd(proj.root())
- .env("HOME", Some(paths::home()));
+ let pr = process(cargo_dir().join("cargo"))
+ .unwrap()
+ .cwd(proj.root())
+ .env("HOME", Some(paths::home()));
let mut path = new_path();
path.push(proj.root().join("path-test"));
})
test!(find_closest_biuld_to_build {
- let pr = process(cargo_dir().join("cargo"))
+ let pr = process(cargo_dir().join("cargo")).unwrap()
.arg("biuld").cwd(paths::root())
.env("HOME", Some(paths::home()));
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
test!(find_closest_dont_correct_nonsense {
- let pr = process(cargo_dir().join("cargo"))
+ let pr = process(cargo_dir().join("cargo")).unwrap()
.arg("asdf").cwd(paths::root())
.env("HOME", Some(paths::home()));
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("hello\n"));
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("hello\n"));
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
test!(cargo_clean_simple {
let p = project("foo")
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
- .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
+ .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(&p.build_dir(), existing_dir());
test!(different_dir {
let p = project("foo")
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
- .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
+ .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice())
.file("src/bar/a.rs", "");
assert_that(p.cargo_process("build"), execs().with_status(0));
use support::{COMPILING, RUNNING, cargo_dir, ProjectBuilder};
use hamcrest::{assert_that, existing_file};
use support::paths::PathExt;
-use cargo;
use cargo::util::process;
fn setup() {
test!(cargo_compile_simple {
let p = project("foo")
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
- .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
+ .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
assert_that(p.cargo_process("build"), execs());
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("i am foo\n"));
})
test!(cargo_compile_manifest_path {
let p = project("foo")
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
- .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
+ .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
assert_that(p.cargo_process("build")
.arg("--manifest-path").arg("foo/Cargo.toml")
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
name = "foo"
"#)
.file("src/main.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
path = "bar"
"#)
- .file("src/foo.rs", main_file(r#""i am foo""#, ["bar"]).as_slice())
+ .file("src/foo.rs", main_file(r#""i am foo""#, &["bar"]).as_slice())
.file("bar/Cargo.toml", basic_bin_manifest("bar").as_slice())
- .file("bar/src/bar.rs", main_file(r#""i am bar""#, []).as_slice());
+ .file("bar/src/bar.rs", main_file(r#""i am bar""#, &[]).as_slice());
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(format!(
assert_that(p.cargo_process("build"), execs().with_status(0));
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout(format!("0-5-1 @ alpha.1 in {}\n",
p.root().display()).as_slice()));
test!(ignore_broken_symlinks {
let p = project("foo")
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
- .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
+ .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice())
.symlink("Notafile", "bar");
assert_that(p.cargo_process("build"), execs());
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("i am foo\n"));
})
"#);
assert_that(p.cargo_process("test"), execs());
- assert_that(process(p.bin("examples/hello")),
+ assert_that(process(p.bin("examples/hello")).unwrap(),
execs().with_stdout("Hello, World!\n"));
- assert_that(process(p.bin("examples/goodbye")),
+ assert_that(process(p.bin("examples/goodbye")).unwrap(),
execs().with_stdout("Goodbye, World!\n"));
})
"#);
assert_that(p.cargo_process("test"), execs().with_status(0));
- assert_that(process(p.bin("examples/hello")),
+ assert_that(process(p.bin("examples/hello")).unwrap(),
execs().with_stdout("Hello, World!\n"));
- assert_that(process(p.bin("examples/goodbye")),
+ assert_that(process(p.bin("examples/goodbye")).unwrap(),
execs().with_stdout("Goodbye, World!\n"));
})
"#);
assert_that(p.cargo_process("build"), execs().with_status(0));
- assert_that(process(p.bin("foo")), execs().with_stdout("slow\n"));
+ assert_that(process(p.bin("foo")).unwrap(), execs().with_stdout("slow\n"));
})
test!(release_build_ndebug {
assert_that(p.cargo_process("build").arg("--release"),
execs().with_status(0));
- assert_that(process(p.bin("release/foo")), execs().with_stdout("fast\n"));
+ assert_that(process(p.bin("release/foo")).unwrap(), execs().with_stdout("fast\n"));
})
test!(inferred_main_bin {
"#);
assert_that(p.cargo_process("build"), execs().with_status(0));
- assert_that(process(p.bin("foo")), execs().with_status(0));
+ assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0));
})
test!(deletion_causes_failure {
.file("target/Cargo.toml", "bad-toml");
assert_that(p.cargo_process("build"), execs().with_status(0));
- assert_that(process(p.bin("foo")), execs().with_status(0));
+ assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0));
})
test!(lib_with_standard_name {
path = "bar"
"#)
.file("src/main.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
})
path = "bar"
"#)
.file("src/main.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs());
let lockfile = p.root().join("Cargo.lock");
let out = os::getenv("CARGO_MANIFEST_DIR").unwrap();
let p1 = Path::new(out);
- let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path());
+ let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path()).unwrap();
assert!(p1 == p2, "{{}} != {{}}", p1.display(), p2.display());
let opt = os::getenv("OPT_LEVEL").unwrap();
name = "foo"
"#, git_project.url()))
- .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
+ .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
let root = project.root();
let git_root = git_project.root();
assert_that(&project.bin("foo"), existing_file());
assert_that(
- cargo::util::process(project.bin("foo")),
+ cargo::util::process(project.bin("foo")).unwrap(),
execs().with_stdout("hello world\n"));
})
name = "foo"
"#, git_project.url()))
- .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
+ .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
let root = project.root();
let git_root = git_project.root();
assert_that(&project.bin("foo"), existing_file());
assert_that(
- cargo::util::process(project.bin("foo")),
+ cargo::util::process(project.bin("foo")).unwrap(),
execs().with_stdout("hello world\n"));
})
name = "foo"
"#, git_project.url()))
- .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
+ .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
let root = project.root();
let git_root = git_project.root();
assert_that(&project.bin("foo"), existing_file());
assert_that(
- cargo::util::process(project.bin("foo")),
+ cargo::util::process(project.bin("foo")).unwrap(),
execs().with_stdout("hello world\n"));
})
name = "parent"
"#, git_project.url()))
.file("src/parent.rs",
- main_file(r#""{}", dep1::hello()"#, ["dep1"]).as_slice());
+ main_file(r#""{}", dep1::hello()"#, &["dep1"]).as_slice());
p.cargo_process("build")
.exec_with_output()
assert_that(&p.bin("parent"), existing_file());
assert_that(
- cargo::util::process(p.bin("parent")),
+ cargo::util::process(p.bin("parent")).unwrap(),
execs().with_stdout("hello world\n"));
})
name = "parent"
"#, git_project.url(), git_project.url()))
.file("src/parent.rs",
- main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, ["dep1", "dep2"]).as_slice());
+ main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, &["dep1", "dep2"]).as_slice());
p.cargo_process("build")
.exec_with_output()
assert_that(&p.bin("parent"), existing_file());
assert_that(
- cargo::util::process(p.bin("parent")),
+ cargo::util::process(p.bin("parent")).unwrap(),
execs().with_stdout("this is dep1 this is dep2\n"));
})
name = "foo"
"#, url))
- .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
+ .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
assert_that(project.cargo_process("build"),
execs()
.with_stdout("")
.with_stderr(format!("Cargo.toml is not a valid manifest\n\n\
- invalid url `{}`: Relative URL without a base\n", url)));
+ invalid url `{}`: relative URL without a base\n", url)));
})
test!(two_revs_same_deps {
name = "foo"
"#, git_project.url()))
.file("src/foo.rs",
- main_file(r#""{}", bar::bar()"#, ["bar"]).as_slice());
+ main_file(r#""{}", bar::bar()"#, &["bar"]).as_slice());
// First time around we should compile both foo and bar
assert_that(p.cargo_process("build"),
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
execs().with_status(0));
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("0\n"));
// Touching bar.rs.in should cause the `build` command to run again.
execs().with_status(0));
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("1\n"));
})
let out = os::getenv("CARGO_MANIFEST_DIR").unwrap();
let p1 = Path::new(out);
- let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path());
+ let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path()).unwrap();
assert!(p1 == p2, "{{}} != {{}}", p1.display(), p2.display());
}}
"#,
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("test passed\n"));
println!("cleaning");
name = "foo"
"#)
.file("src/main.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
let p2 = project("bar")
.file("Cargo.toml", r#"
[package]
name = "foo"
"#)
.file("src/main.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
let p2 = project("bar")
.file("Cargo.toml", r#"
[package]
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("zoidberg\n"));
})
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("src/bar/Cargo.toml", r#"
[project]
name = "foo"
"#)
.file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
.file("bar/Cargo.toml", r#"
[project]
assert_that(&p.bin("foo"), existing_file());
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("0\n"));
// Touching bar.rs.in should cause the `build` command to run again.
COMPILING, p.url())));
assert_that(
- cargo::util::process(p.bin("foo")),
+ cargo::util::process(p.bin("foo")).unwrap(),
execs().with_stdout("1\n"));
})
assert_that(&p.target_bin(target, "foo"), existing_file());
assert_that(
- process(p.target_bin(target, "foo")),
+ process(p.target_bin(target, "foo")).unwrap(),
execs().with_status(0));
})
assert_that(&p.target_bin(target, "foo"), existing_file());
assert_that(
- process(p.target_bin(target, "foo")),
+ process(p.target_bin(target, "foo")).unwrap(),
execs().with_status(0));
})
assert_that(&foo.target_bin(target, "foo"), existing_file());
assert_that(
- process(foo.target_bin(target, "foo")),
+ process(foo.target_bin(target, "foo")).unwrap(),
execs().with_status(0));
})
assert_that(&foo.target_bin(target, "foo"), existing_file());
assert_that(
- process(foo.target_bin(target, "foo")),
+ process(foo.target_bin(target, "foo")).unwrap(),
execs().with_status(0));
})
}
fn my_process(s: &str) -> ProcessBuilder {
- process(s)
+ process(s).unwrap()
.cwd(paths::root())
.env("HOME", Some(paths::home()))
}
fn cargo_process(s: &str) -> ProcessBuilder {
- process(cargo_dir().join("cargo")).arg(s)
+ process(cargo_dir().join("cargo")).unwrap().arg(s)
.cwd(paths::root())
.env("HOME", Some(paths::home()))
}
})
test!(finds_author_git {
- my_process("git").args(["config", "--global", "user.name", "bar"])
+ my_process("git").args(&["config", "--global", "user.name", "bar"])
.exec().assert();
- my_process("git").args(["config", "--global", "user.email", "baz"])
+ my_process("git").args(&["config", "--global", "user.email", "baz"])
.exec().assert();
assert_that(cargo_process("new").arg("foo").env("USER", Some("foo")),
execs().with_status(0));
})
test!(author_prefers_cargo {
- my_process("git").args(["config", "--global", "user.name", "bar"])
+ my_process("git").args(&["config", "--global", "user.name", "bar"])
.exec().assert();
- my_process("git").args(["config", "--global", "user.email", "baz"])
+ my_process("git").args(&["config", "--global", "user.email", "baz"])
.exec().assert();
let root = paths::root();
fs::mkdir(&root.join(".cargo"), USER_RWX).assert();
use flate2::reader::GzDecoder;
use support::{project, execs, cargo_dir, ResultTest};
-use support::{PACKAGING, WARNING, VERIFYING, COMPILING};
+use support::{PACKAGING, VERIFYING, COMPILING};
use hamcrest::{assert_that, existing_file};
fn setup() {
"#)
.file("src/main.rs", "fn main() {}");
- r::mock_pkg("bar", "0.0.1", []);
+ r::mock_pkg("bar", "0.0.1", &[]);
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
"#)
.file("src/main.rs", "fn main() {}");
- r::mock_pkg("baz", "0.0.1", []);
- r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
+ r::mock_pkg("baz", "0.0.1", &[]);
+ r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
"#)
.file("src/main.rs", "fn main() {}");
- r::mock_pkg("bad-cksum", "0.0.1", []);
+ r::mock_pkg("bad-cksum", "0.0.1", &[]);
File::create(&r::mock_archive_dst("bad-cksum", "0.0.1")).unwrap();
assert_that(p.cargo_process("build").arg("-v"),
version required: >= 0.0.0
"));
- r::mock_pkg("notyet", "0.0.1", []);
+ r::mock_pkg("notyet", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(format!("\
version required: ^0.0.1
"));
- r::mock_pkg("notyet", "0.0.1", []);
+ r::mock_pkg("notyet", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("package"),
execs().with_status(0).with_stdout(format!("\
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("bar", "0.0.1", []);
+ r::mock_pkg("bar", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(format!("\
dir = p.url()).as_slice()));
p.root().move_into_the_past().unwrap();
- r::mock_pkg("bar", "0.0.2", []);
+ r::mock_pkg("bar", "0.0.2", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(""));
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("baz", "0.0.1", []);
- r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
+ r::mock_pkg("baz", "0.0.1", &[]);
+ r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(format!("\
dir = p.url()).as_slice()));
p.root().move_into_the_past().unwrap();
- r::mock_pkg("baz", "0.0.2", []);
- r::mock_pkg("bar", "0.0.2", [("baz", "*")]);
+ r::mock_pkg("baz", "0.0.2", &[]);
+ r::mock_pkg("bar", "0.0.2", &[("baz", "*")]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(""));
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("baz", "0.0.1", []);
- r::mock_pkg_yank("baz", "0.0.2", [], true);
- r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
- r::mock_pkg_yank("bar", "0.0.2", [("baz", "*")], true);
+ r::mock_pkg("baz", "0.0.1", &[]);
+ r::mock_pkg_yank("baz", "0.0.2", &[], true);
+ r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
+ r::mock_pkg_yank("bar", "0.0.2", &[("baz", "*")], true);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(format!("\
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("baz", "0.0.1", []);
- r::mock_pkg_yank("baz", "0.0.2", [], true);
- r::mock_pkg("bar", "0.0.1", [("baz", "=0.0.2")]);
+ r::mock_pkg("baz", "0.0.1", &[]);
+ r::mock_pkg_yank("baz", "0.0.2", &[], true);
+ r::mock_pkg("bar", "0.0.1", &[("baz", "=0.0.2")]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(101).with_stderr("\
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("bar", "0.0.1", []);
+ r::mock_pkg("bar", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0));
fs::rmdir_recursive(&r::registry_path().join("3")).unwrap();
- r::mock_pkg_yank("bar", "0.0.1", [], true);
+ r::mock_pkg_yank("bar", "0.0.1", &[], true);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(""));
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("bar", "0.0.1", []);
+ r::mock_pkg("bar", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0));
p.root().move_into_the_past().unwrap();
.file("src/main.rs", "fn main() {}");
p.build();
- r::mock_pkg("bar", "0.0.1", []);
+ r::mock_pkg("bar", "0.0.1", &[]);
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0));
- r::mock_pkg("bar", "0.0.2", []);
+ r::mock_pkg("bar", "0.0.2", &[]);
fs::rmdir_recursive(&paths::home().join(".cargo/registry")).unwrap();
assert_that(p.process(cargo_dir().join("cargo")).arg("update")
.arg("-p").arg("bar"),
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("hello\n"));
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
assert_that(&p.bin("foo"), existing_file());
assert_that(
- process(p.bin("foo")),
+ process(p.bin("foo")).unwrap(),
execs().with_stdout("hello\n"));
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),